<?php
namespace app\admin\controller;

use think\Controller;
use think\Session;
use think\Db;

/**
 * 股票控制器
 */
class Gupiao extends Controller
{
    /**
     * 股票列表
     */
    public function lists()
    {
        $data = Db::name('gupiao')->order('id desc')->select();
        $this->assign('data',$data);
        return $this->fetch();
    }


    /**
     * 添加股票
     */
    public function add()
    {
        if(request()->isPost()){

            $data['name']       = input('name');
            $data['short_name'] = input('short_name');
            $data['code']       = input('code');
            $data['price']      = input('price',0.00);
            $data['create_time']= time();
            $data['update_time']= time();
            Db('gupiao')->insert($data);

            $this->success('成功');
        }

    	return $this->fetch();
    }



}
